<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Inviter
 * @copyright  Copyright Hire-Experts LLC
 * @license    http://www.hire-experts.com
 * @version    $Id: Level.php 2010-03-31 10:15 ermek $
 * @author     Ermek
 */

/**
 * @category   Application_Extensions
 * @package    Inviter
 * @copyright  Copyright Hire-Experts LLC
 * @license    http://www.hire-experts.com
 */

class Inviter_Form_Admin_Providers extends Engine_Form {
	public function init() {
		$module_path = Engine_Api::_ ()->getModuleBootstrap ( 'inviter' )->getModulePath ();
		$this->addPrefixPath ( 'Engine_Form_Decorator_', $module_path . '/Form/Decorator/', 'decorator' );
		
		$this->setTitle ( 'INVITER_Providers Settings' )->setDescription ( "INVITER_FORM_ADMIN_PROVIDERS_DESCRIPTION" )->setOptions ( array ('class' => 'he_inviter_settings' ) );
		
		$settings = Engine_Api::_ ()->getApi ( 'settings', 'core' );
		$translate = $this->getTranslator ();
		
		// Facebook
		$this->addElement ( 'Text', 'inviter_facebook_consumer_key', array ('label' => 'Facebook App ID', 'value' => $settings->getSetting ( 'inviter.facebook.consumer.key', '' ) ) );
		
		$this->addElement ( 'Text', 'inviter_facebook_consumer_secret', array ('label' => 'Facebook App Secret', 'value' => $settings->getSetting ( 'inviter.facebook.consumer.secret', '' ) ) );
		
		$this->addDisplayGroup ( array ('inviter_facebook_consumer_key', 'inviter_facebook_consumer_secret' ), 'facebook_settings', array ('class' => 'he_setting_fieldset' ) );
		
		$this->getDisplayGroup ( 'facebook_settings' )->addDecorator ( 'ProviderDescription', array ('label' => $translate->_ ( 'Facebook settings' ), 'description' => $translate->_ ( 'USER_ADMIN_SETTINGS_FACEBOOK_DESCRIPTION' ) ) );
		
		// Twitter
		$this->addElement ( 'Text', 'inviter_twitter_consumer_key', array ('label' => 'Consumer key', 'value' => $settings->getSetting ( 'inviter.twitter.consumer.key', '' ) ) );
		
		$this->addElement ( 'Text', 'inviter_twitter_consumer_secret', array ('label' => 'Consumer secret', 'value' => $settings->getSetting ( 'inviter.twitter.consumer.secret', '' ) ) );
		
		$this->addDisplayGroup ( array ('inviter_twitter_consumer_key', 'inviter_twitter_consumer_secret' ), 'twitter_settings', array ('class' => 'he_setting_fieldset' ) );
		
		$this->getDisplayGroup ( 'twitter_settings' )->addDecorator ( 'ProviderDescription', array ('label' => $translate->_ ( 'Twitter settings' ), 'description' => $translate->_ ( 'INVITER_TWITTER_APP_DESC' ) ) );
		
		// LinkedIn
		$this->addElement ( 'Text', 'inviter_linkedin_consumer_key', array ('label' => 'API Key', 'value' => $settings->getSetting ( 'inviter.linkedin.consumer.key', '' ) ) );
		
		$this->addElement ( 'Text', 'inviter_linkedin_consumer_secret', array ('label' => 'Secret Key', 'value' => $settings->getSetting ( 'inviter.linkedin.consumer.secret', '' ) ) );
		
		$this->addDisplayGroup ( array ('inviter_linkedin_consumer_key', 'inviter_linkedin_consumer_secret' ), 'linkedin_settings', array ('class' => 'he_setting_fieldset' ) );
		
		$this->getDisplayGroup ( 'linkedin_settings' )->addDecorator ( 'ProviderDescription', array ('label' => $translate->_ ( 'LinkedIn settings' ), 'description' => $translate->_ ( 'INVITER_LINKEDIN_APP_DESC' ) ) );
		
		// GMail
		$this->addElement ( 'Text', 'inviter_gmail_consumer_key', array ('label' => 'OAuth Consumer Key', 'value' => $settings->getSetting ( 'inviter.gmail.consumer.key', '' ) ) );
		
		$this->addElement ( 'Text', 'inviter_gmail_consumer_secret', array ('label' => 'OAuth Consumer Secret', 'value' => $settings->getSetting ( 'inviter.gmail.consumer.secret', '' ) ) );
		
		$this->addDisplayGroup ( array ('inviter_gmail_consumer_key', 'inviter_gmail_consumer_secret' ), 'gmail_settings', array ('class' => 'he_setting_fieldset' ) );
		
		$this->getDisplayGroup ( 'gmail_settings' )->addDecorator ( 'ProviderDescription', array ('label' => $translate->_ ( 'GMail settings' ), 'description' => $translate->_ ( 'INVITER_GMAIL_APP_DESC' ) ) );
		
		// Add submit button
		$this->addElement ( 'Button', 'submit', array ('label' => 'Save Changes', 'type' => 'submit', 'ignore' => true ) );
	}
}